<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="lib/angular.min.js"></script>
	<script type='text/javascript' src='lib/angular-router.js'></script>
</head>
<body ng-app="myApp">
			<div ng-controller="MainCtrl">
			     <input type="text" ng-model="test"  ng-change="change()" />
			     输入的值是—{{test}}
			</div>
			<div ng-controller="sideCtrl">
				<button ng-click="add()" ng-modle ="name">刷新</button>
				    <div >my name {{name}}</div>
			</div>
      		<div ng-controller="overCtrl">
      			<button>刷新</button>
      			<div></div>
      		</div>
      
      <script>
			var app = angular.module('myApp', []);
			app.factory('instance', function(){
			    return {
			    	name:2,
			    	setname:function(a){
			    		this.name = a;
			    	}
			    };
			});
			app.controller('MainCtrl', function($scope, instance) {
				$scope.test = instance.name;
			    $scope.change = function() {
			       instance.setname($scope.test) ;
			  };
			});
			app.controller('sideCtrl', function($scope, instance) {
				$scope.name = instance.name;
			    $scope.add = function() {
			        $scope.name = instance.name;
			    };
			});
		</script>
			      
		</body>
			</html>